import request from '@/utils/request'

// 查询菜单列表
export function listDept(query) {
  return request({
    url: '/api/system/dept',
    method: 'get',
    params: query,
  })
}

// 查询菜单详细
export function getDept(deptId) {
  return request({
    url: '/api/system/dept/' + deptId,
    method: 'get',
  })
}

export function listDeptExcludeChild(deptId) {
  return request({
    url: '/api/system/dept/dept-exclude-child/' + deptId,
    method: 'get',
  })
}

// 根据角色ID查询部门树结构
export function roleDeptTreeselect(roleId) {
  return request({
    url: '/api/system/dept/role-dept-tree-select/' + roleId,
    method: 'get',
  })
}

// 查询菜单下拉树结构
export function treeselect() {
  return request({
    url: '/api/system/dept/tree-select',
    method: 'get',
  })
}

// 新增菜单
export function addDept(data) {
  return request({
    url: '/api/system/dept',
    method: 'post',
    data: data,
  })
}

// 修改菜单
export function updateDept(data) {
  return request({
    url: '/api/system/dept',
    method: 'put',
    data: data,
  })
}

// 删除菜单
export function delDept(deptId) {
  return request({
    url: '/api/system/dept/' + deptId,
    method: 'delete',
  })
}
